package com.salelogistics.system.api.factory;

import com.salelogistics.common.core.web.domain.AjaxResult;
import com.salelogistics.common.core.web.page.TableDataInfo;
import com.salelogistics.system.api.RemoteBasLotService;
import com.salelogistics.system.api.domain.BasLot;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteBasLotFallBackFactory implements FallbackFactory<RemoteBasLotService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteBasLotService.class);

    @Override
    public RemoteBasLotService create(Throwable throwable) {
        log.error("服务调用失败:{}", throwable.getMessage());
        return new RemoteBasLotService() {

            @Override
            public AjaxResult selectBasLotById(Long id) {
                return AjaxResult.error("查询失败-"+throwable.getMessage());
            }

            @Override
            public TableDataInfo selectBasLotList(BasLot basLot) {
                TableDataInfo tableDataInfo=new TableDataInfo();
                tableDataInfo.setMsg("查询失败-"+throwable.getMessage());
                return tableDataInfo;
            }
        };
    }
}
